package com.exam.online.system.dao;

import com.exam.online.system.entity.Teacher;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TeacherDAO {
    int deleteByPrimaryKey(Integer id);

    int insert(Teacher record);

    int insertSelective(Teacher record);

    Teacher selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Teacher record);

    int updateByPrimaryKey(Teacher record);


    @Select("select * from t_teacher where account=#{account} and password=#{password} and state=1")
    Teacher teacherLogin(@Param("account") String account, @Param("password") String password);

    @Select("select * from t_teacher where state=1 limit #{pageNo},#{pageSize}")
    List<Teacher> getAllTeacher(@Param("pageNo") Integer pageNo,@Param("pageSize") Integer pageSize);
    @Select("select count(*) from t_teacher ")
    Integer getAllTeacherCount();


    @Update("update `t_teacher` set state=2 where id=#{teacherId}")
    int deleteTeacher(@Param("teacherId") Integer teacherId);
}